import http from "./request";
// home/recommendSubject/list
// 分页查询推荐
export const getHomeRecSubList = (
  params: ISubjectListParams
): PRES<IHomeSubjectList> => {
  //   console.log(params);
  return http.get("home/recommendSubject/list", { params });
};

// home/recommendSubject/delete
// 批量删除推荐
export const homeRecSubDel = (ids: number[]): PRES<IReqSort> => {
  return http.post(`home/recommendSubject/delete?ids=${ids}`);
};

// home/recommendSubject/update/recommendStatus
// 批量修改推荐状态
export const homeRecUpDtaSubSta = (
  ids: number[],
  recommendStatus: number
): PRES<IReqSort> =>
  http.post(
    `home/recommendSubject/update/recommendStatus?ids=${ids}&recommendStatus=${recommendStatus}`
  );

// home/recommendSubject/update/sort/{id}
// 修改推荐排序
export const recProUpdateSort = (id: number, sort: number): PRES<IReqSort> =>
  http.post(`home/recommendSubject/update/sort/${id}?sort=${sort}`);

// 获取
// subject/list
// 根据专题名称分页获取专题
export const getSubjectList = (
  params: subjectListParams
): PRES<subjectList> => {
  console.log(params);
  return http.get("subject/list", { params });
};

// home/recommendSubject/create
// 添加首页推荐专题

export const postCreateHomeRecSub = (
  params: newProductModel[]
): PRES<IReqSort> => {
  return http.post(`home/recommendSubject/create`, params);
};
